<?php
session_start();
if (isset($_SESSION['msgAlert'])){
	$msgAlert = $_SESSION['msgAlert'];
	unset($_SESSION['msgAlert']);
}
 

$clienteId         = $ClienteFrm->clienteId;
$tipo              = $ClienteFrm->tipo;
$nombre            = $ClienteFrm->nombre;  
$docIdent          = $ClienteFrm->docIdent;  
$nacExt            = $ClienteFrm->nacExt;   
$direcc1           = $ClienteFrm->direcc1;   
$direcc2           = $ClienteFrm->direcc2;   
$ciudad            = $ClienteFrm->ciudad;   
$direccEstado      = $ClienteFrm->direccEstado;   
$pais    	         = $ClienteFrm->pais;   
$telefono          = $ClienteFrm->telefono;   
$telefono2         = $ClienteFrm->telefono2;   
$email             = $ClienteFrm->email;   
$contacto          = $ClienteFrm->contacto;  
$vendedor          = $ClienteFrm->vendedor;   
$terminosPago      = $ClienteFrm->terminosPago;   
$plazoDiasPago     = $ClienteFrm->plazoDiasPago;   
$inicioFecha       = $ClienteFrm->inicioFecha;   
$observacion       = $ClienteFrm->observacion;   
$estado            = $ClienteFrm->estado;   
$creaUsr           = $ClienteFrm->creaUsr;   
$creaFecha         = $ClienteFrm->creaFecha;   
$modifUsr          = $ClienteFrm->modifUsr;   
$modifFecha        = $ClienteFrm->modifFecha;  

$a_listaTerminosPago  = $ClienteFrm->listaTerminosPago;   
$a_listaVendedor      = $ClienteFrm->listaVendedor;   


$contextMenu[0]["link"]      = "javascript:fn_nuevo()";
$contextMenu[0]["linkIcon"]  = "application_add.png";
$contextMenu[0]["linkTitle"] = "Nuevo cliente";

$contextMenu[1]["link"]      = "javascript:fn_listar()";
$contextMenu[1]["linkIcon"]  = "application_view_list.png";
$contextMenu[1]["linkTitle"] = "Lista";

$contextMenu[2]["link"]      = "?do=Cliente&accion=eliminarCliente&clienteId=".$clienteId;
$contextMenu[2]["linkIcon"]  = "page_white_delete.png";
$contextMenu[2]["linkTitle"] = "Eliminar cliente";


?>
<script>
	function fn_nuevo(){
		$("#zonaContenedor").load("/gourmet-express/trunk/src/index.php?do=Cliente&accion=shwForm", function(){
		
		});
	}; 
	function fn_listar(){
		$("#zonaContenedor").load("/gourmet-express/trunk/src/index.php?do=Cliente&accion=listarClienteForm", function(){
		
		});
	}; 	


	
</script>


<script>
    function openWindow(url){
		window.open(url,'Wpopup','toolbar=no,location=no left=10 hight=10,scrollbars=yes,width=600,height=125,location=no');	
	}
</script>

<body>

<div id="module">
   <?php include $_SERVER['DOCUMENT_ROOT'].'/gourmet-express/trunk/src/views/header.inc'; ?>
	<h3>:: Cliente</h3>
    <div id="moduleContent">
	<form id='frmCliente'>
		<table id="form" width="100%">	     
            <tr>
                <td id="keyLabel">Codigo</td>
                <td>                    
                    <INPUT TYPE="text" NAME="clienteId" value="<?php echo $clienteId;?>"/>
                </td>
                <td id="label">Activo</td>
                <td>
                    <input type="checkbox" name="estado" id="activo" value="Y" <?php if ($estado){echo " CHECKED ";}?>/>
                </td>
            </tr>
            <tr>
                <td id="label">Nombre</td>
				<td><input type="text" name="nombre" value="<?php echo $nombre;?>" size="50" maxlenght="50"/></td>
				<td id="label">&nbsp;</td>
				<td>&nbsp;</td>
	    	</tr>                         
 			<tr>
                <td id="label">Direccion</td>
				<td><input name="direccion1" type="text" id="direccion1" value="<?php echo $direccion1;?>" size="50" maxlenght="50"/></td>
				<td id="label">Doc.Identidad (DNI RUC)</td>
				<td><input name="docIdent" type="text" id="docIdent" value="<?php echo $docIdent;?>" size="20" maxlenght="20"/></td>
	    	</tr>             
            <tr>
                <td id="label">&nbsp;</td>
				<td><input name="direccion2" type="text" id="direccion2" value="<?php echo $direccion2;?>" size="50" maxlenght="50"/></td>
				<td id="label">Nacional-Extranjero</td>
				<td><select name="nacExt" id="nacExt">
				  <option></option>
				  <? 
							foreach ($a_undMedArticulo as $valor) {
								?>
				  <option <? if ($valor->getValorId() == $undMedida){echo "SELECTED";}?> value="<?php echo $valor->getValorId()?>"><? echo $valor->getDescripcion()?></option>
				  <?
							}
						?>
			    </select></td>
	    	</tr>             
            <tr>
                <td id="label">Ciudad</td>
				<td><input name="ciudad" type="text" id="ciudad" value="<?php echo $ciudad;?>" size="50" maxlenght="50"/></td>
				<td id="label">Vendedor</td>
				<td><select name="vendedor" id="vendedor">
				  <option></option>
				  <? 
							foreach ($a_vendedor as $valor) {
								?>
				  <option <? if ($valor->getVendedorId() == $vendedor){echo "SELECTED";}?> value="<?php echo $valor->getVendedorId()?>"><? echo $valor->getVendedorId()?></option>
				  <?
							}
						?>
			    </select></td>
	    	</tr>             
            <tr>
                <td id="label">Estado</td>
				<td><input name="estado" type="text" id="estado" value="<?php echo $estado;?>" size="50" maxlenght="50"/></td>
				<td id="label">Terminos de pago</td>
				<td><select name="terminosPago" id="terminosPago">
				  <option></option>
				  <? 
							foreach ($a_terminosPago as $valor) {
								?>
				  <option <? if ($valor->getTerminosPago() == $undMedidaVenta){echo "SELECTED";}?> value="<?php echo $valor->getValorId()?>"><? echo $valor->getDescripcion()?></option>
				  <?
							}
						?>
			    </select></td>
	   		</tr>             
            <tr>
                <td id="label">Pais</td>
				<td><input name="pais" type="text" id="pais" value="<?php echo $pais;?>" size="50" maxlenght="50"/></td>
				<td id="label">Plazo de pago (dias)</td>
				<td><INPUT NAME="plazoDiasPago" TYPE="text" id="plazoDiasPago" value="<?php echo $plazoDiasPago;?>" size="10" maxlenght="10"/></td>
	    	</tr>             
            <tr>
                <td id="label">Contacto</td>
				<td><input name="contacto" type="text" id="contacto" value="<?php echo $contacto;?>" size="50" maxlenght="50"/></td>
				<td id="label">Inicio fecha</td>
				<td><INPUT NAME="inicioFecha" TYPE="text" id="inicioFecha" value="<?php echo $inicioFecha;?>" size="10" maxlenght="10"/></td>
	    	</tr>             
            <tr>
                <td id="label">Email</td>
				<td><input name="pais3" type="text" id="pais3" value="<?php echo $email;?>" size="50" maxlenght="50"/></td>
				<td id="label">&nbsp;</td>
				<td>&nbsp;</td>
	    	</tr>                     
            <tr>
                <td id="label">Memo</td>
				<td>
                    <textarea name="memo" cols="47" rows="2"><? echo $memo?></textarea>
                </td>
				<td id="label"></td>
				<td></td>
	    	</tr>           
            <tr>
                <td id="label">Registro</td>
				<td></td>
				<td id="label">Actualizacion</td>
				<td></td>
	    	</tr>             
            <tr>
                <td></td>
				<td></td>
				<td></td>
				<td>
					<input type="button" value="Guardar" name="aceptar2" onClick="javascript : fn_guardar()"/>				
					<input type="button" id="btn_cancelar"name="btn_cancelar" onClick="javascript: listarClientes()" value="Cancelar">
				</td>
	    	</tr>
	    </table>
   	</form>	    
  </div>
</body>
</html>
